const express = require('express');
const wearService = require('../services/wearImgService');

var router = express.Router();

// 所有商品展示
// 发送数据，type: 'kid/woman/man/mobile'
router.get('/detail', async function (req, res) {
    // console.log(req.query)        //{ type: 'kid/woman/man/mobile' }
    if (!req) {
        res.send({
            success: false,
            msg: 'ajax data is error!'
        })
    } else {
        var data = await wearService.findImg(req.query.type);
        res.send(data);
    }
})

// 部分商品展示
router.get('/detailNum', async function (req, res) {
    // console.log(req.query)        //{ type: 'kid/woman/man/mobile' }
    if (!req) {
        res.send({
            success: false,
            msg: 'ajax data is error!'
        })
    } else {
        var data = await wearService.findNumImg(req.query.type);
        res.send(data);
    }
})

exports.router = router;